#ifndef __TASKQUEUE_H__
#define __TASKQUEUE_H__

#include <mutex>
#include <queue>
#include <condition_variable>

using std::mutex;
using std::queue;
using std::condition_variable;

class Task;

using ElemType = Task *;

class TaskQueue
{
public:
    TaskQueue(int capa);
    ~TaskQueue();
    void push(ElemType ptask);
    ElemType pop();
    bool empty()const;
    bool full()const;

private:
    int _capacity;
    mutex _mt;
    queue<ElemType> _que;
    condition_variable _cvproducer;
    condition_variable _cvconsumer;
};
#endif

